	
<template>
	<view>
		<view class="u-margin-bottom-20 list" v-for="(item,index) in list" :key="index" @click="go(item)">
			<view class="u-border-bottom  u-padding-bottom-20 u-flex u-row-between">
				<view class="   $u-type-info" >
				  订单ID：{{item.outTradeNo}}	
				</view>
				
				<view style="color: #3464D6;">
					{{item.cn?'普通洗车':'万能洗车'}}
				</view>
			</view>
			
			<view class="u-flex u-row-between  u-padding-top-20 u-padding-bottom-20">
				<view>{{item.storeName}}</view>
				<view>合计：<text class="$u-type-error">￥{{item.totalMoney}}</text></view>
			</view>
			<view class="u-margin-bottom-20">
				服务时间:{{item.minute}}分钟
			</view>
			<view class="u-padding-top-20 u-border-top $u-type-info">{{item.storeAddress}}</view>
			
			<view class="u-flex u-flex-end u-margin-top-20">
				<u-button size="mini" type="primary" v-if="item.status==1" @click="end(item)">结束订单</u-button>
				<u-button size="mini"  type="success" v-else>已完成</u-button>
			</view>
			
			
			
		</view>
		
		<u-loadmore :status="status" />
	
	</view>
	
</template>

<script>
	export default{
		data(){
			return{
				list:[],
				page: 1,
				status: 'loadmore',
					
					
			}
		},
	
		onShow(){
			this.page=1;
			this.jiazai()
		},
		onReachBottom() {
			if (this.status == 'nomore') {
		
			} else {
				this.jiazai()
			}
		
		},
		methods:{
		 go(item) {
		 	uni.navigateTo({
		 		url: "./detail?info=" + encodeURIComponent(JSON.stringify(item))
		 	})
		 },
		 end(item){
			 this.$u.post('/api/indent/WashFinish', {
			     orders_id:item.id,
			 }).then(res => {	
			 	this.$refs.uToast.show({
			 		title: '开门成功',
			 		type: 'success',
			 		callback:()=>{
						this.page=1;
			 			this.jiazai()
			 		}
			 		
			 	})
			 }).catch(err => {
			    
			 })
		 },
		 jiazai(){
			 this.$u.post('/api/indent/WashOrder', {
			 	page:this.page,
			 }).then(res => {
			 	var resList = res;
			 	if (this.page == 1) {
			 		this.list = []
			 	}
			 	if (resList.length > 9) {
			 		this.status = 'loadmore'
			 		this.page = this.page + 1
			 	} else {
			 		this.status = 'nomore'
			 	}
			 	this.list = this.list.concat(resList)
			 	this.loading = false
			 }).catch(err => {
			 
			 })
			
		 }
		   
		}
	}
</script>

<style>
	page{
		background: #F1F1F1;
	}
	.list{
		background: #FFFFFF;
		padding: 30rpx;
	}
</style>
